* {
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    margin: 0;
    padding: 20px;
    background: linear-gradient(135deg, #0f0f1e 0%, #0a0a1a 100%);
    color: #e6e6e6;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

h1 {
    text-align: center;
    color: #f8c555;
    margin-bottom: 5px;
    text-shadow: 0 0 15px rgba(248, 197, 85, 0.7);
    font-size: 2.5rem;
    padding: 10px 0;
}

.subtitle {
    text-align: center;
    color: #aaa;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.game-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.7);
    padding: 12px 20px;
    border-radius: 10px;
    border: 1px solid #333;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    flex-wrap: wrap;
    gap: 10px;
}

.current-item-info {
    font-size: 1.1rem;
    color: #f8c555;
    font-weight: bold;
}

.game-phase {
    font-size: 1rem;
    color: #4a9eff;
    font-weight: bold;
}

.game-area {
    display: flex;
    flex: 1;
    gap: 20px;
    min-height: 0;
    overflow: hidden;
}

.auction-section {
    flex: 1;
    min-width: 350px;
    background: rgba(10, 10, 20, 0.8);
    border-radius: 15px;
    padding: 20px;
    border: 1px solid #333;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.auction-section h2 {
    color: #f8c555;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #333;
    text-align: center;
}

.players-section {
    flex: 1;
    min-width: 350px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
    padding-right: 5px;
}

.players-section::-webkit-scrollbar {
    width: 8px;
}

.players-section::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

.players-section::-webkit-scrollbar-thumb {
    background: #f8c555;
    border-radius: 4px;
}

.player-card {
    background: linear-gradient(145deg, rgba(20, 20, 40, 0.9), rgba(10, 10, 25, 0.9));
    border-radius: 12px;
    padding: 18px;
    border: 2px solid #333;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    transition: all 0.3s ease;
}

.player-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5);
}

.player-card.player {
    border-color: #4a9eff;
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.4);
}

.player-card.computer {
    border-color: #444;
}

.player-card.computer:hover {
    border-color: #ff6b6b;
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 2px solid #333;
    padding-bottom: 8px;
}

.player-name {
    font-weight: bold;
    font-size: 1.2rem;
}

.player-name.player {
    color: #4a9eff;
    text-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

.player-name.computer {
    color: #ff6b6b;
    text-shadow: 0 0 8px rgba(255, 107, 107, 0.3);
}

.player-gold {
    color: #f8c555;
    font-weight: bold;
    font-size: 1.1rem;
    background: rgba(248, 197, 85, 0.1);
    padding: 5px 10px;
    border-radius: 20px;
}

.health-bar {
    height: 22px;
    background: #222;
    border-radius: 11px;
    margin: 12px 0;
    overflow: hidden;
    border: 1px solid #333;
    position: relative;
}

.health-fill {
    height: 100%;
    border-radius: 11px;
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.health-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.health-fill.high { background: linear-gradient(90deg, #2ed573, #1dd1a1); }
.health-fill.medium { background: linear-gradient(90deg, #ffa502, #ff7f00); }
.health-fill.low { background: linear-gradient(90deg, #ff4757, #ff3838); }

.player-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 6px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
    border-left: 3px solid #f8c555;
}

.stat-label {
    color: #aaa;
    font-size: 0.9rem;
}

.stat-value {
    font-weight: bold;
    color: #fff;
    font-size: 0.95rem;
}

.current-bid {
    background: linear-gradient(135deg, rgba(248, 197, 85, 0.15), rgba(248, 197, 85, 0.05));
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    text-align: center;
    border: 2px solid rgba(248, 197, 85, 0.3);
    box-shadow: inset 0 0 20px rgba(248, 197, 85, 0.1);
}

.current-bid div {
    font-size: 1.1rem;
    margin: 5px 0;
}

.current-bid span {
    color: #f8c555;
    font-weight: bold;
    font-size: 1.2rem;
}

.bid-controls {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.bid-input {
    flex: 1;
    padding: 12px 15px;
    background: rgba(20, 20, 30, 0.9);
    border: 2px solid #444;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    transition: all 0.3s;
}

.bid-input:focus {
    outline: none;
    border-color: #4a9eff;
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.3);
}

.bid-button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #4a9eff, #2d8aff);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s;
    min-width: 100px;
}

.bid-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #2d8aff, #1a7aff);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(45, 138, 255, 0.4);
}

.bid-button:disabled {
    background: #555;
    cursor: not-allowed;
    opacity: 0.6;
}

.pass-button {
    padding: 12px 25px;
    background: linear-gradient(135deg, #ff6b6b, #ff5252);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1rem;
    transition: all 0.3s;
    min-width: 100px;
}

.pass-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff5252, #ff3838);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
}

.auction-item {
    background: linear-gradient(145deg, rgba(30, 30, 60, 0.9), rgba(20, 20, 40, 0.9));
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 5px solid #f8c555;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.item-name {
    font-size: 1.4rem;
    font-weight: bold;
    color: #f8c555;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(248, 197, 85, 0.3);
}

.item-type {
    display: inline-block;
    padding: 4px 12px;
    background: #333;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-bottom: 12px;
    font-weight: bold;
    letter-spacing: 1px;
}

.type-profession { background: linear-gradient(135deg, #9b59b6, #8e44ad); }
.type-weapon { background: linear-gradient(135deg, #e74c3c, #c0392b); }
.type-equipment { background: linear-gradient(135deg, #3498db, #2980b9); }
.type-item { background: linear-gradient(135deg, #2ecc71, #27ae60); }

.item-desc {
    color: #ccc;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 6px;
}

.item-bid-info {
    display: flex;
    justify-content: space-between;
    color: #aaa;
    font-size: 0.9rem;
    padding-top: 10px;
    border-top: 1px solid #333;
}

.item-bid-info span {
    color: #f8c555;
    font-weight: bold;
}

.log-section {
    flex: 1;
    max-height: 200px;          /* 限制最大高度，实现小框效果 */
    background: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    padding: 15px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;           /* 隐藏超出部分，由内部滚动 */
    min-height: 200px;          /* 可选，保留最小高度 */
}

#log-container {
    flex: 1;
    overflow-y: auto;           /* 内部可滚动 */
    padding-right: 5px;
}

.log-title {
    color: #f8c555;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #333;
    font-size: 1.1rem;
    font-weight: bold;
}

#log-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

#log-container::-webkit-scrollbar {
    width: 8px;
}

#log-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

#log-container::-webkit-scrollbar-thumb {
    background: #f8c555;
    border-radius: 4px;
}

.log-entry {
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-entry.player { color: #4a9eff; }
.log-entry.computer { color: #ff6b6b; }
.log-entry.system { color: #f8c555; }
.log-entry.attack { color: #ff6b6b; font-weight: bold; }
.log-entry.heal { color: #2ecc71; font-weight: bold; }

.winner-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.winner-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 50px;
    border-radius: 20px;
    text-align: center;
    border: 3px solid #f8c555;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.winner-title {
    color: #f8c555;
    font-size: 2.5rem;
    margin-bottom: 20px;
    text-shadow: 0 0 20px rgba(248, 197, 85, 0.5);
}

.winner-name {
    font-size: 2rem;
    margin-bottom: 30px;
    color: #4a9eff;
    text-shadow: 0 0 15px rgba(74, 158, 255, 0.5);
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 2px solid #f8c555;
}

.restart-button {
    padding: 18px 40px;
    background: linear-gradient(135deg, #4a9eff, #2d8aff);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.3s;
    margin-top: 20px;
    box-shadow: 0 8px 25px rgba(45, 138, 255, 0.3);
}

.restart-button:hover {
    background: linear-gradient(135deg, #2d8aff, #1a7aff);
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(45, 138, 255, 0.4);
}

/* ========== 移动端优化 (卡片缩略 + 操作区置顶) ========== */
@media (max-width: 700px) {
    body { padding: 8px; }
    .container { height: calc(100vh - 16px); gap: 8px; }
    h1 { font-size: 1.6rem; padding: 5px 0; }
    .subtitle { font-size: 0.85rem; margin-bottom: 5px; }
    .game-info { padding: 6px 10px; font-size: 0.9rem; }

    .game-area {
        flex-direction: column;
        gap: 8px;
    }

    /* 拍卖区：占据剩余空间，无最大高度限制 */
    .auction-section {
        flex: 1;
        order: 2;
        max-height: none;
        padding-bottom: 5px;
        overflow: hidden;
    }

    /* 玩家卡片区：在上方 */
    .players-section {
        flex: 0 0 auto;
        order: 1;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        margin-top: 0;
    }

    /* 日志区域：固定最大高度，内部滚动 */
    .log-section {
        flex: 0 0 auto;
        max-height: 180px;
        min-height: 100px;
        margin-bottom: 10px;
        overflow: hidden;
    }

    #log-container {
        overflow-y: auto;
        max-height: calc(100% - 40px); /* 40px 约为标题+内边距高度 */
    }

    /* 其他拍卖元素固定高度，不参与伸缩 */
    .auction-item,
    .current-bid,
    .bid-controls {
        flex-shrink: 0;
    }

    /* 卡片样式不变 */
    .player-card {
        padding: 6px 4px;
        min-width: 0;
        flex: 1 1 30%;
        border-width: 1px;
    }

    .player-header {
        margin-bottom: 4px;
        padding-bottom: 2px;
        border-bottom-width: 1px;
        flex-direction: column;
        align-items: flex-start;
    }

    .player-name { font-size: 0.75rem; }
    .player-gold { font-size: 0.65rem; padding: 2px 5px; }

    .health-bar { display: none; }

    .player-card > .stat-item:not(.player-stats .stat-item) {
        display: none;
    }

    .player-stats {
        display: flex;
        flex-wrap: wrap;
        gap: 2px;
        margin-bottom: 0;
        grid-template-columns: none;
        justify-content: center;
    }

    .player-stats .stat-item {
        padding: 2px 4px;
        border-left-width: 2px;
        background: rgba(0,0,0,0.5);
        flex: 1 0 auto;
        min-width: 35px;
        justify-content: center;
    }

    .player-stats .stat-item .stat-label {
        display: none;
    }

    .player-stats .stat-item .stat-value {
        font-size: 0.7rem;
        white-space: nowrap;
    }

    .player-stats .stat-item:nth-child(1) .stat-value::before { content: "❤️"; margin-right: 2px; font-size: 0.7rem; }
    .player-stats .stat-item:nth-child(2) .stat-value::before { content: "⚔️"; margin-right: 2px; font-size: 0.7rem; }
    .player-stats .stat-item:nth-child(3) .stat-value::before { content: "🛡️"; margin-right: 2px; font-size: 0.7rem; }
    .player-stats .stat-item:nth-child(4) .stat-value::before { content: "💥"; margin-right: 2px; font-size: 0.7rem; }

    .current-bid { padding: 8px; margin: 10px 0; }
    .bid-controls { flex-wrap: wrap; }
    .bid-input, .bid-button, .pass-button { min-width: auto; font-size: 0.9rem; padding: 8px; }
    .item-name { font-size: 1.1rem; }
}

/* 更小屏 确保三个卡片在一行 */
@media (max-width: 450px) {
    .player-card { padding: 4px 2px; }
    .player-name { font-size: 0.65rem; }
    .player-gold { font-size: 0.55rem; padding: 1px 3px; }
    .player-stats .stat-item .stat-value { font-size: 0.6rem; }
    .player-stats .stat-item:nth-child(1) .stat-value::before,
    .player-stats .stat-item:nth-child(2) .stat-value::before,
    .player-stats .stat-item:nth-child(3) .stat-value::before,
    .player-stats .stat-item:nth-child(4) .stat-value::before { font-size: 0.6rem; }
}

/* ========== 桌面端卡片紧凑化 (宽度≥701px) ========== */
@media (min-width: 701px) {
    /* 卡片整体缩小 */
    .player-card {
        padding: 8px 12px;
        margin-bottom: 8px;
    }

    .player-header {
        margin-bottom: 6px;
        padding-bottom: 4px;
    }

    .player-name {
        font-size: 1rem;
    }

    .player-gold {
        font-size: 0.9rem;
        padding: 3px 8px;
    }

    .health-bar {
        height: 16px;
        margin: 8px 0;
    }

    .player-stats {
        gap: 6px;
        margin-bottom: 6px;
    }

    .stat-item {
        padding: 3px 6px;
    }

    /* 职业、敌人、物品行紧凑显示 */
    .player-card > .stat-item:not(.player-stats .stat-item) {
        padding: 3px 6px;
        margin-top: 2px;
        margin-bottom: 2px;
        font-size: 0.85rem;
        border-left-width: 2px;
    }

    /* 隐藏原有的文字标签（职业、敌人、持有物品） */
    .player-card > .stat-item:not(.player-stats .stat-item) .stat-label {
        display: none;
    }

    /* 职业行：图标 */
    .player-card .stat-item:has(> .stat-value[id$="-class"]) .stat-value::before {
        content: "👤 ";
        font-size: 0.9rem;
        margin-right: 4px;
    }

    /* 敌人行：添加靶心图标 */
    .player-card .stat-item:has(> .stat-value[id$="-enemy"]) .stat-value::before {
        content: "🎯 ";
        font-size: 0.9rem;
        margin-right: 4px;
    }

    /* 物品行：添加收纳袋图标，并限制长度避免换行 */
    .player-card .stat-item:has(> .stat-value[id$="-items"]) .stat-value::before {
        content: "📦 ";
        font-size: 0.9rem;
        margin-right: 4px;
    }

    .player-card .stat-item:has(> .stat-value[id$="-items"]) .stat-value {
        max-width: 135px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
        vertical-align: middle;
    }
}